<{include file="head.html"}>
<div class="reg_main">
    <center><h1>用户登陆</h1></center>
    <div class="reg_box">
        <div style="width: 260px;margin:auto;">
        <form method="POST" id="logform">
            <input type="hidden" name="referer" value="<{$smarty.server.HTTP_REFERER}>"/>
            <table style="border:0">
                <tr><td>用户名：</td><td colspan="2"><input type="text" name="username" value=""/></td></tr>
                <tr><td>密  码：</td><td colspan="2"><input type="password" name="pw" value=""/></td></tr>
                <tr><td>验证码：</td><td><input type="text" style="width: 80px;" name="seccode" value=""/></td><td><img src="seccode.php" onclick="this.src='seccode.php?'+Math.random()"/></td></tr>
                <tr><td colspan="3"><div align="center"><input type="button" id="logsubmit" value="提交" style="height:35px;width:100px;background-color:#FFDD99;border: 1px #B50000 solid;cursor: pointer;color:#B50000; "/></div></td></tr>
            </table>
        </form>
            <script>
                $(function(){
                    $("#logsubmit").click(function(){
                        var form=$("#logform");
                        username=form.find("input[name='username']").val();
                        pw=form.find("input[name=pw]").val();
                        seccode=form.find("input[name=seccode]").val();
                        referer=form.find("input[name=referer]").val();
                        if(username==""){
                            alert('用户名不能为空');
                            return false;
                        }
                        if(pw==""){
                            alert('密码不能为空');
                            return false;
                        }
                        if(seccode==""){
                            alert('验证码不能为空');
                            return false;
                        }
                        arr={username:username,pw:pw,seccode:seccode,action:'ajax',submit:'submit'};
                        $.ajax({
                            type:"POST",
                            url:"<{$config.SITE_URL}>/login.php",
                            dataType:"html",
                            cache:false,
                            data:arr,
                            success:
                                function(html){
                                if(html=='ok'){
                                    window.location.href = referer;
                                }else{
                                    alert(html);
                                }
                            }
                        });
                    });
                    
                })
                
            </script>
        </div>
    </div>
</div>
<{include file="foot.html"}>
